This function calculates the entropy of the given dataset, which is a measure of the level of disorder in the data set, commonly used in information theory and machine learning.